﻿namespace ACCOUNTING
{
    using ACCOUNTING.LVY.Business;
    using ACCOUNTING.My;
    using ACCOUNTING.My.Resources;
    using C1.Win.C1Command;
    using C1.Win.C1FlexGrid;
    using C1.Win.C1FlexGrid.Util.BaseControls;
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Diagnostics;
    using System.Drawing;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms;

    [DesignerGenerated]
    public class Frm_DangKyHoaDonList : Form
    {
        private static List<WeakReference> __ENCList = new List<WeakReference>();
        [AccessedThroughProperty("C1DockingTab2")]
        private C1DockingTab _C1DockingTab2;
        [AccessedThroughProperty("C1DockingTabPage2")]
        private C1DockingTabPage _C1DockingTabPage2;
        [AccessedThroughProperty("CboLoaiHoaDon")]
        private ComboBox _CboLoaiHoaDon;
        [AccessedThroughProperty("CboMauHoaDon")]
        private ComboBox _CboMauHoaDon;
        [AccessedThroughProperty("CboSoKiHieu")]
        private ComboBox _CboSoKiHieu;
        [AccessedThroughProperty("CmdDangKy")]
        private Button _CmdDangKy;
        [AccessedThroughProperty("CmdLoad")]
        private Button _CmdLoad;
        [AccessedThroughProperty("CmdXoaDong")]
        private Button _CmdXoaDong;
        [AccessedThroughProperty("Panel1")]
        private Panel _Panel1;
        [AccessedThroughProperty("Panel2")]
        private Panel _Panel2;
        [AccessedThroughProperty("VSList")]
        private C1.Win.C1FlexGrid.C1FlexGrid _VSList;
        private IContainer components;
        private bool mAllowAdd;
        private bool mAllowDel;
        private bool mAllowEdit;
        private bool mAllowView;
        private clsDangKyHoaDon objDKHD;
        private DataTable pData;

        public Frm_DangKyHoaDonList()
        {
            base.Load += new EventHandler(this.Frm_DangKyHoaDonList_Load);
            List<WeakReference> list = __ENCList;
            lock (list)
            {
                __ENCList.Add(new WeakReference(this));
            }
            this.mAllowEdit = true;
            this.mAllowDel = true;
            this.mAllowView = true;
            this.mAllowAdd = true;
            this.objDKHD = new clsDangKyHoaDon();
            this.pData = new DataTable();
            this.InitializeComponent();
        }

        private void CboLoaiHoaDon_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.CboMauHoaDon.Focus();
            if (this.CboLoaiHoaDon.SelectedIndex > 0)
            {
                BuildComboModule.BuildCombo(this.CboMauHoaDon, modGeneral.ListDanhMuc.MauHoaDon, true, "KhoaLoaiHoaDonIn = '" + this.CboLoaiHoaDon.SelectedValue.ToString().Trim() + "'", "");
            }
            else
            {
                this.CboMauHoaDon.DataSource = this.pData;
                this.CboMauHoaDon.DisplayMember = "Ten";
                this.CboMauHoaDon.ValueMember = "Ma";
            }
        }

        private void CboMauHoaDon_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.CboSoKiHieu.Focus();
            if (this.CboLoaiHoaDon.SelectedIndex > 0)
            {
                BuildComboModule.BuildCombo(this.CboSoKiHieu, modGeneral.ListDanhMuc.SoKiHieu, true, "MauHoaDOn = '" + this.CboMauHoaDon.SelectedValue.ToString().Trim() + "'", "");
            }
            else
            {
                this.CboMauHoaDon.DataSource = this.pData;
                this.CboMauHoaDon.DisplayMember = "Ten";
                this.CboMauHoaDon.ValueMember = "Ma";
            }
        }

        private void CboSoKiHieu_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.LoadData();
        }

        private void CmdDangKy_Click(object sender, EventArgs e)
        {
            MyProject.Forms.Frm_DangKyHoaDon.Dispose();
            MyProject.Forms.Frm_DangKyHoaDon.ShowDialog();
        }

        private void CmdLoad_Click(object sender, EventArgs e)
        {
            this.LoadData();
        }

        private void CmdXoaDong_Click(object sender, EventArgs e)
        {
            if ((this.VSList.Rows.Count != 1) && (this.VSList.Row > 0))
            {
                if (!this.objDKHD.CheckViTriXoa(Conversions.ToString(this.VSList[this.VSList.Row, 0]), Conversions.ToString(this.VSList[this.VSList.Row, 1]), Conversions.ToString(this.VSList[this.VSList.Row, 2]), Conversions.ToInteger(this.VSList[this.VSList.Row, 5])))
                {
                    LVYModule.ShowWarning("H\x00f3a đơn đăng k\x00fd n\x00e0y kh\x00f4ng thể x\x00f3a được !");
                }
                else if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectGreaterEqual(this.VSList[this.VSList.Row, 3], this.VSList[this.VSList.Row, 5], false))
                {
                    LVYModule.ShowWarning("H\x00f3a đơn đăng k\x00fd n\x00e0y đ\x00e3 được sử dụng, kh\x00f4ng thể x\x00f3a !");
                }
                else if (LVYModule.ConfirmDelete("") && this.objDKHD.DelData(Conversions.ToString(this.VSList[this.VSList.Row, 1]), Conversions.ToString(this.VSList[this.VSList.Row, 2]), Conversions.ToInteger(this.VSList[this.VSList.Row, 5])))
                {
                    this.LoadData();
                }
            }
        }

        [DebuggerNonUserCode]
        protected override void Dispose(bool disposing)
        {
            try
            {
                if (disposing && (this.components != null))
                {
                    this.components.Dispose();
                }
            }
            finally
            {
                base.Dispose(disposing);
            }
        }

        private void Frm_DangKyHoaDonList_Load(object sender, EventArgs e)
        {
            LVYModule.GetUserRight(ref this.mAllowView, ref this.mAllowDel, ref this.mAllowEdit, ref this.mAllowAdd, Conversions.ToString(this.Tag), modGeneral.H_USERNAME);
            if (!this.mAllowView)
            {
                LVYModule.ShowWarning(modGeneral.Tranlated("Bạn kh\x00f4ng c\x00f3 quyền xem, li\x00ean hệ với người quản trị để biết th\x00eam chi tiết.", ""));
                this.Dispose();
            }
            else
            {
                this.pData.Columns.Add("Ma", typeof(string));
                this.pData.Columns.Add("Ten", typeof(string));
                this.pData.Rows.Add(new object[] { "", "" });
                BuildComboModule.BuildCombo(this.CboLoaiHoaDon, modGeneral.ListDanhMuc.LoaiHoaDonIn, true, "", "");
                this.CboLoaiHoaDon.SelectedIndex = 1;
                this.CboLoaiHoaDon.Enabled = false;
                this.LoadData();
            }
        }

        [DebuggerStepThrough]
        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(Frm_DangKyHoaDonList));
            this.VSList = new C1.Win.C1FlexGrid.C1FlexGrid();
            this.CmdDangKy = new Button();
            this.Panel1 = new Panel();
            this.CmdXoaDong = new Button();
            this.C1DockingTabPage2 = new C1DockingTabPage();
            this.Panel2 = new Panel();
            this.CboSoKiHieu = new ComboBox();
            this.CboMauHoaDon = new ComboBox();
            this.CboLoaiHoaDon = new ComboBox();
            this.CmdLoad = new Button();
            this.C1DockingTab2 = new C1DockingTab();
            this.VSList.BeginInit();
            this.Panel1.SuspendLayout();
            this.C1DockingTabPage2.SuspendLayout();
            this.Panel2.SuspendLayout();
            ((ISupportInitialize) this.C1DockingTab2).BeginInit();
            this.C1DockingTab2.SuspendLayout();
            this.SuspendLayout();
            this.VSList.AllowEditing = false;
            this.VSList.AutoResize = false;
            this.VSList.BorderStyle = C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.Light3D;
            this.VSList.ColumnInfo = manager.GetString("VSList.ColumnInfo");
            this.VSList.Dock = DockStyle.Fill;
            this.VSList.ExtendLastCol = true;
            this.VSList.FocusRect = FocusRectEnum.None;
            Point point = new Point(0, 0x1f);
            this.VSList.Location = point;
            this.VSList.Name = "VSList";
            this.VSList.Rows.Count = 1;
            this.VSList.Rows.DefaultSize = 0x11;
            this.VSList.SelectionMode = SelectionModeEnum.Row;
            Size size = new Size(0x374, 0x12f);
            this.VSList.Size = size;
            this.VSList.StyleInfo = manager.GetString("VSList.StyleInfo");
            this.VSList.TabIndex = 7;
            this.VSList.VisualStyle = C1.Win.C1FlexGrid.VisualStyle.Office2007Blue;
            this.CmdDangKy.Image = ACCOUNTING.My.Resources.Resources.Adds;
            this.CmdDangKy.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(3, 6);
            this.CmdDangKy.Location = point;
            this.CmdDangKy.Name = "CmdDangKy";
            size = new Size(0x6b, 0x17);
            this.CmdDangKy.Size = size;
            this.CmdDangKy.TabIndex = 0;
            this.CmdDangKy.Text = "&1. Đăng k\x00fd";
            this.CmdDangKy.UseVisualStyleBackColor = true;
            this.Panel1.BackgroundImage = ACCOUNTING.My.Resources.Resources.bgleft;
            this.Panel1.Controls.Add(this.CmdXoaDong);
            this.Panel1.Controls.Add(this.CmdDangKy);
            this.Panel1.Dock = DockStyle.Bottom;
            point = new Point(0, 0x12d);
            this.Panel1.Location = point;
            this.Panel1.Name = "Panel1";
            size = new Size(0x374, 0x21);
            this.Panel1.Size = size;
            this.Panel1.TabIndex = 8;
            this.CmdXoaDong.Image = ACCOUNTING.My.Resources.Resources.Remove;
            this.CmdXoaDong.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(0x74, 6);
            this.CmdXoaDong.Location = point;
            this.CmdXoaDong.Name = "CmdXoaDong";
            size = new Size(0x6b, 0x17);
            this.CmdXoaDong.Size = size;
            this.CmdXoaDong.TabIndex = 1;
            this.CmdXoaDong.Text = "&2. X\x00f3a d\x00f2ng";
            this.CmdXoaDong.UseVisualStyleBackColor = true;
            this.C1DockingTabPage2.Controls.Add(this.Panel1);
            this.C1DockingTabPage2.Controls.Add(this.VSList);
            this.C1DockingTabPage2.Controls.Add(this.Panel2);
            this.C1DockingTabPage2.Image = ACCOUNTING.My.Resources.Resources.Selected;
            point = new Point(1, 0x19);
            this.C1DockingTabPage2.Location = point;
            this.C1DockingTabPage2.Name = "C1DockingTabPage2";
            size = new Size(0x374, 0x14e);
            this.C1DockingTabPage2.Size = size;
            this.C1DockingTabPage2.TabIndex = 0;
            this.C1DockingTabPage2.Text = "Danh s\x00e1ch h\x00f3a đơn đ\x00e3 đăng k\x00fd sử dụng";
            this.Panel2.BackgroundImage = ACCOUNTING.My.Resources.Resources.bgleft;
            this.Panel2.Controls.Add(this.CboSoKiHieu);
            this.Panel2.Controls.Add(this.CboMauHoaDon);
            this.Panel2.Controls.Add(this.CboLoaiHoaDon);
            this.Panel2.Controls.Add(this.CmdLoad);
            this.Panel2.Dock = DockStyle.Top;
            point = new Point(0, 0);
            this.Panel2.Location = point;
            this.Panel2.Name = "Panel2";
            size = new Size(0x374, 0x1f);
            this.Panel2.Size = size;
            this.Panel2.TabIndex = 9;
            this.CboSoKiHieu.DropDownStyle = ComboBoxStyle.DropDownList;
            this.CboSoKiHieu.FormattingEnabled = true;
            point = new Point(260, 5);
            this.CboSoKiHieu.Location = point;
            this.CboSoKiHieu.Name = "CboSoKiHieu";
            size = new Size(0x79, 0x15);
            this.CboSoKiHieu.Size = size;
            this.CboSoKiHieu.TabIndex = 1;
            this.CboMauHoaDon.DropDownStyle = ComboBoxStyle.DropDownList;
            this.CboMauHoaDon.FormattingEnabled = true;
            point = new Point(0x85, 5);
            this.CboMauHoaDon.Location = point;
            this.CboMauHoaDon.Name = "CboMauHoaDon";
            size = new Size(0x79, 0x15);
            this.CboMauHoaDon.Size = size;
            this.CboMauHoaDon.TabIndex = 1;
            this.CboLoaiHoaDon.DropDownStyle = ComboBoxStyle.DropDownList;
            this.CboLoaiHoaDon.FormattingEnabled = true;
            point = new Point(6, 5);
            this.CboLoaiHoaDon.Location = point;
            this.CboLoaiHoaDon.Name = "CboLoaiHoaDon";
            size = new Size(0x79, 0x15);
            this.CboLoaiHoaDon.Size = size;
            this.CboLoaiHoaDon.TabIndex = 1;
            this.CmdLoad.Image = ACCOUNTING.My.Resources.Resources.Refresh;
            this.CmdLoad.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(0x310, 5);
            this.CmdLoad.Location = point;
            this.CmdLoad.Name = "CmdLoad";
            size = new Size(0x61, 0x17);
            this.CmdLoad.Size = size;
            this.CmdLoad.TabIndex = 0;
            this.CmdLoad.Text = "Cập nhật";
            this.CmdLoad.UseVisualStyleBackColor = true;
            this.C1DockingTab2.Controls.Add(this.C1DockingTabPage2);
            this.C1DockingTab2.Dock = DockStyle.Fill;
            point = new Point(0, 0);
            this.C1DockingTab2.Location = point;
            this.C1DockingTab2.Name = "C1DockingTab2";
            size = new Size(0x376, 360);
            this.C1DockingTab2.Size = size;
            this.C1DockingTab2.TabIndex = 4;
            this.C1DockingTab2.TabsSpacing = 5;
            this.C1DockingTab2.TabStyle = TabStyleEnum.Office2007;
            this.C1DockingTab2.VisualStyle = C1.Win.C1Command.VisualStyle.Office2007Blue;
            this.C1DockingTab2.VisualStyleBase = C1.Win.C1Command.VisualStyle.Office2007Blue;
            SizeF ef = new SizeF(6f, 13f);
            this.AutoScaleDimensions = ef;
            this.AutoScaleMode = AutoScaleMode.Font;
            size = new Size(0x376, 360);
            this.ClientSize = size;
            this.Controls.Add(this.C1DockingTab2);
            this.FormBorderStyle = FormBorderStyle.FixedSingle;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "Frm_DangKyHoaDonList";
            this.StartPosition = FormStartPosition.CenterScreen;
            this.Tag = "HT-0006";
            this.Text = "DANH SACH HOA DON DA DANG KY SU DUNG";
            this.VSList.EndInit();
            this.Panel1.ResumeLayout(false);
            this.C1DockingTabPage2.ResumeLayout(false);
            this.Panel2.ResumeLayout(false);
            ((ISupportInitialize) this.C1DockingTab2).EndInit();
            this.C1DockingTab2.ResumeLayout(false);
            this.ResumeLayout(false);
        }

        public void LoadData()
        {
            string pLoaiHoaDon = Conversions.ToString(LVYModule.ReturnIfNull(this.CboLoaiHoaDon.Text.Trim(), "", modGeneral.TypeOfValue.Nothing));
            string pMauHoaDon = Conversions.ToString(LVYModule.ReturnIfNull(this.CboMauHoaDon.Text.Trim(), "", modGeneral.TypeOfValue.Nothing));
            string pSoKiHieu = Conversions.ToString(LVYModule.ReturnIfNull(this.CboSoKiHieu.Text.Trim(), "", modGeneral.TypeOfValue.Nothing));
            DataTable table = this.objDKHD.ShowList(pLoaiHoaDon, pMauHoaDon, pSoKiHieu);
            this.VSList.Select(0, 0);
            this.VSList.Rows.Count = 1;
            int num2 = table.Rows.Count - 1;
            for (int i = 0; i <= num2; i++)
            {
                C1.Win.C1FlexGrid.C1FlexGrid vSList = this.VSList;
                vSList.AddItem("");
                vSList[vSList.Rows.Count - 1, 0] = RuntimeHelpers.GetObjectValue(table.Rows[i]["LoaiHoaDonIn"]);
                vSList[vSList.Rows.Count - 1, 1] = RuntimeHelpers.GetObjectValue(table.Rows[i]["MauHoaDon"]);
                vSList[vSList.Rows.Count - 1, 2] = RuntimeHelpers.GetObjectValue(table.Rows[i]["SoKiHieu"]);
                vSList[vSList.Rows.Count - 1, 3] = RuntimeHelpers.GetObjectValue(table.Rows[i]["SoHienTai"]);
                vSList[vSList.Rows.Count - 1, 4] = LVYModule.Char2Date(Conversions.ToString(table.Rows[i]["NgayBDSD"]));
                vSList[vSList.Rows.Count - 1, 5] = RuntimeHelpers.GetObjectValue(table.Rows[i]["TuSo"]);
                vSList[vSList.Rows.Count - 1, 6] = RuntimeHelpers.GetObjectValue(table.Rows[i]["DenSo"]);
                vSList[vSList.Rows.Count - 1, 7] = RuntimeHelpers.GetObjectValue(table.Rows[i]["SoLuong"]);
                vSList[vSList.Rows.Count - 1, 8] = RuntimeHelpers.GetObjectValue(table.Rows[i]["SoDuDK"]);
                vSList = null;
            }
        }

        internal virtual C1DockingTab C1DockingTab2
        {
            [DebuggerNonUserCode]
            get
            {
                return this._C1DockingTab2;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._C1DockingTab2 = value;
            }
        }

        internal virtual C1DockingTabPage C1DockingTabPage2
        {
            [DebuggerNonUserCode]
            get
            {
                return this._C1DockingTabPage2;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._C1DockingTabPage2 = value;
            }
        }

        internal virtual ComboBox CboLoaiHoaDon
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CboLoaiHoaDon;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CboLoaiHoaDon_SelectedIndexChanged);
                if (this._CboLoaiHoaDon != null)
                {
                    this._CboLoaiHoaDon.SelectedIndexChanged -= handler;
                }
                this._CboLoaiHoaDon = value;
                if (this._CboLoaiHoaDon != null)
                {
                    this._CboLoaiHoaDon.SelectedIndexChanged += handler;
                }
            }
        }

        internal virtual ComboBox CboMauHoaDon
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CboMauHoaDon;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CboMauHoaDon_SelectedIndexChanged);
                if (this._CboMauHoaDon != null)
                {
                    this._CboMauHoaDon.SelectedIndexChanged -= handler;
                }
                this._CboMauHoaDon = value;
                if (this._CboMauHoaDon != null)
                {
                    this._CboMauHoaDon.SelectedIndexChanged += handler;
                }
            }
        }

        internal virtual ComboBox CboSoKiHieu
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CboSoKiHieu;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CboSoKiHieu_SelectedIndexChanged);
                if (this._CboSoKiHieu != null)
                {
                    this._CboSoKiHieu.SelectedIndexChanged -= handler;
                }
                this._CboSoKiHieu = value;
                if (this._CboSoKiHieu != null)
                {
                    this._CboSoKiHieu.SelectedIndexChanged += handler;
                }
            }
        }

        internal virtual Button CmdDangKy
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdDangKy;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdDangKy_Click);
                if (this._CmdDangKy != null)
                {
                    this._CmdDangKy.Click -= handler;
                }
                this._CmdDangKy = value;
                if (this._CmdDangKy != null)
                {
                    this._CmdDangKy.Click += handler;
                }
            }
        }

        internal virtual Button CmdLoad
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdLoad;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdLoad_Click);
                if (this._CmdLoad != null)
                {
                    this._CmdLoad.Click -= handler;
                }
                this._CmdLoad = value;
                if (this._CmdLoad != null)
                {
                    this._CmdLoad.Click += handler;
                }
            }
        }

        internal virtual Button CmdXoaDong
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdXoaDong;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdXoaDong_Click);
                if (this._CmdXoaDong != null)
                {
                    this._CmdXoaDong.Click -= handler;
                }
                this._CmdXoaDong = value;
                if (this._CmdXoaDong != null)
                {
                    this._CmdXoaDong.Click += handler;
                }
            }
        }

        internal virtual Panel Panel1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel1 = value;
            }
        }

        internal virtual Panel Panel2
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel2;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel2 = value;
            }
        }

        internal virtual C1.Win.C1FlexGrid.C1FlexGrid VSList
        {
            [DebuggerNonUserCode]
            get
            {
                return this._VSList;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._VSList = value;
            }
        }
    }
}

